home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1992-09-28 | 4.0 KB | 132 lines |
- '***************************
- '* AMOS Professional *
- '* *
- '* MENUS 4 *
- '* * Keyboard shortcuts
- '* (c) Europress Software * and
- '* * Deleting menu items
- '* Ronnie Simpson *
- '***************************
- '
- '-------------------------------------------
- 'KEYBOARD SHORTCUTS
- '-------------------------------------------
- 'Using the Menu Key instruction
- '
- 'Keyboard shortcuts can be assigned to any of the base level menu options but
- 'NOT to any of the sub-options.
- 'Either a string containing a single character or the internal scancode
- 'number can be used to assign the menu items to the keyboard for example:-
- '
- ' Menu Key(1,1) To "a" (lower case single character)
- ' Menu Key(2,1) To "B" (Upper case would require a key shift)
- ' Menu Key(2,2) To 95 (scancode 95 is the help key)
- '
- 'Another optional parameter can also be added to test for the control
- 'keys, the status of these keys are held in a bit-map in the same format
- 'as the Key Shift function.
- '
- 'eg. Menu Key(1,1) to 80,%00001000
- '
- 'If more than 1 bit is set then all the appropriate keys will have to be
- 'held down together for the menu item to be called.
- ' (See Key Shift instruction for more details)
- '
- 'A keyboard shortcut can be turned off by using Key Shift without any
- 'perameters. eg. Menu Key (1,1)
- '
- '-------------------------------------------
- 'DELETING MENU ITEMS
- '-------------------------------------------
- 'To erase all or part of your menu the instruction Menu Del is used.
- '
- 'Without any parameters Menu Del erases the entire menu and returns the
- 'memory to the system.
- '
- 'By adding in the normal format you can erase any single item:-
- '
- ' Menu Del (2,1) (erase option 2 from title 1)
- ' Menu Del (3) (erase title 3)
- '
- '-------------------------------------------
- 'WORKING EXAMPLE
- '-------------------------------------------
- Dim T$(5)
- '
- Rem *** tidy up the screen
- '
- Screen Open 0,640,200,16,Hires
- Palette $0,$F00,$F0,$F,$FF0,$F0F,$FF,$EE7,$7F,$70F,$F07,$5F7,$F75,$57F,$CCC,$FFF
- Flash Off : Curs Off : Cls 0 : Pen 0 : Paper 7 : Ink 14,0
- '
- Rem *** set the menu titles
- '
- Menu$(1)=" CONTROL "
- Menu$(2)=" POINTER SHAPE "
- Menu$(3)=" COLOURS "
- '
- Rem *** set the options
- '
- Menu$(1,1)=" QUIT "
- '
- Menu$(2,1)=" POINTER "
- Menu$(2,2)=" CROSS-HAIRS "
- Menu$(2,3)=" CLOCK "
- '
- Menu$(3,1)=" RED " : Menu Key(3,1) To "1"
- Menu$(3,2)=" GREEN " : Menu Key(3,2) To "2"
- Menu$(3,3)=" BLUE " : Menu Key(3,3) To "3"
- Menu$(3,4)=" YELLOW " : Menu Key(3,4) To "4"
- Menu$(3,5)=" MAGENTA " : Menu Key(3,5) To "5"
- Menu$(3,6)=" CYAN " : Menu Key(3,6) To "6"
- T$(1)="Press right mouse key to see the menu."
- T$(2)="Menu control is now independant of the main program."
- T$(3)="Each title has its own procedure."
- T$(4)="On Menu avoids using too many If...Then statements."
- T$(5)="Select CONTROL/QUIT from the menu to return to the editor."
- '
- Menu Key(1,1) To "q"
- Menu Key(2,1) To "p"
- Menu Key(2,2) To "x"
- Menu Key(2,3) To "c"
- '
- Rem *** start the automatic checking
- '
- Menu On
- On Menu Proc CONTROL,MOUSE,KOLOURS
- On Menu On
- '
- Pen 12 : Paper 0
- Locate 0,13 : Centre "Keyboard shortcuts introduced to change options"
- Pen 13 : Locate 21,15 : Print "CONTROL POINTER SHAPE COLOURS"
- Pen 11 : Locate 21,17 : Print "q=Quit p=pointer 1-RED"
- Locate 34,18 : Print "x=crosshairs 2-GREEN"
- Locate 34,19 : Print "c=clock 3-BLUE"
- Locate 52,20 : Print "4-YELLOW"
- Locate 52,21 : Print "5-MAGENTA"
- Locate 52,22 : Print "6-CYAN"
- '
- Rem *** loop whilst waiting for menu
- '
- Do
- Add COUNT,1,1 To 3000
- If COUNT=500
- Add N,1,1 To 5
- Text 100,N*12+22,T$(N)
- End If
- Loop
- '
- Procedure CONTROL
- Edit
- End Proc
- '
- Procedure MOUSE
- Change Mouse Choice(2)
- On Menu On
- End Proc
- '
- Procedure KOLOURS
- Shared T$()
- Ink Choice(2),0
- On Menu On
- End Proc